*Replication code for analysis in "Cruelty Campaign: Solitary Confinement in US Immigration Detention, 09/17/2025"

**********************************ANALYSIS********************************
use monthly_solitary, clear 

**p. 12: number of unique individuals placed in solitary from April 2024 to May 2025
total Placements // 10558

**p. 12: number of individuals placed in solitary before the December policy change in reporting, April 2024 to November 2024
total Placements if inrange(modate, tm(2024m4), tm(2024m11)) // 4579

**p. 12: percent change from November to January 
total Placements if modate==tm(2024m11) // 551
total Placements if modate==tm(2025m1)  // 986
di (986-551)/551 // 79% increase

**p. 12: average monthly percent change in number of people in solitary 2024-2025
use monthly_solitary, clear 
collapse (sum) Placement, by(modate)
tsset modate
gen change_placements=100*(d.Placements/l.Placements)
label var change "Percent Change in Placements"
mean change_placements if inrange(modate, tm(2025m3), tm(2025m5)) // 6.48 during Trump
mean change_placements if inrange(modate, tm(2024m4), tm(2024m11)) // 1.01 during Biden

**p. 12: average monthly percent change in number of solitary placements 2018-2023
use srms_data, clear
gen PlacementM=month(PlacementD)
gen Placements=1
collapse (sum) Placements, by(PlacementY PlacementM)
drop if PlacementY==2017 | (PlacementY==2018 & PlacementM<=9) | (PlacementY==2023 & PlacementM==9) // removes incomplete months
gen modate = ym(PlacementY, PlacementM) 
format modate %tmNN/YY
tsset modate
gen change_placements=100*(d.Placements/l.Placements)
label var change "Percent Change in Placements"
sum change // 3.4 percent

**p. 13: number of individuals in solitary confinement out of initial book-ins in May 2024 compared to May 2025
use bookins_2024_2025, clear
total Prop if modate==tm(2024m5)  // 203.2748 in May 2024
total Prop if modate==tm(2025m5)   // 390.31844 in May 2025
di 100*(390.31844-203.2748)/203.2748 // 92% increase

**p. 13: number of solitary confinement placements out of initial book-ins change from September 2018 to September 2023 compared to May 2025
use bookins_2018_2023, clear
sum confinement_prop // 75
di 100*(390.31844-74.97492)/74.97492 // 420.6% increase

**p 14: top 5 facilities with highest number of individuals placed in solitary from April 2024 – May 2025
use monthly_solitary, clear
collapse (sum) Placement, by(Facilities)
gsort -Placements 
list Facilities Placement in 1/10

**p 14: top 10 facilities with highest ADP from April 2024 – May 2025
use capacity_may25, clear
gsort -capacity
list facilities capacity in 1/10

**p. 15: number of vulnerable individuals from October 2021 – May 2025
use vulnerable_populations, clear
sum Number if Year==2022 & PlacementR=="Total Unique" // 265
sum Number if Year==2025 & PlacementR=="Total Unique" // 413
di (413-265)/265 // 56% increase

**p. 16: average cumulative duration of solitary confinement placements in Q1 2022 and Q2 2025
sum AverageNumberofCumulativeDay if qdate==tq(2022Q1) & PlacementR=="Grand Total" // 20
sum AverageNumberofCumulativeDay if qdate==tq(2025Q2) & PlacementR=="Grand Total" // 44

**p. 16: average consecutive duration individuals spend in solitary confinement in Q1 2022 and Q2 2025
sum AverageNumberofConsecutiveDa if qdate==tq(2022q1) & PlacementR=="Grand Total" // 14
sum AverageNumberofConsecutiveDa if qdate==tq(2025q2) & PlacementR=="Grand Total" // 38


*********************New England*********************
**p. 18: number of facilities and placements from September 2018 to September 2023
use srms_data, clear
table Facility if NE==1 // 5 facilities
tab NE // 186 placements

**pp. 18-19: number of facilities and individuals placed in solitary from April 2024 to May 2025
use monthly_solitary, clear 
keep if NE==1
table Facilities // 4 facilities
collapse (sum) Placement if NE==1 // 212 individuals placed in solitary per facility

**pp. 19: number of individuals placed in solitary from April 2024 to May 2025 per facility
use monthly_solitary, clear 
keep if NE==1
collapse (sum) Placement, by(Facilities)
bysort Facilities: sum Placement

**p. 19: duration of solitary confinement placements from September 2018 to September 2023
use srms_data, clear
table (Facility) if NE==1, statistic(mean Length) stat(median Length) stat(frequency) stat(percent) 

**p. 20: average duration of solitary confinement placements from September 2018 to September 2023
use srms_data, clear
table (Facility) if NE==1, statistic(mean Length) stat(median Length) stat(frequency) stat(percent) // NE average 29
table (Facility), statistic(mean Length) stat(median Length) stat(frequency) stat(percent) // national average 26

**p. 20: percent of solitary confinement placements lasting 15 days or longer
use srms_data, clear
gen Longer15=Length>=15 
replace Longer=. if Length==.
bysort NE: tab Longer15 // n=45 below 15, 140 above (=76% were in confinement 15 days or longer).
tab Longer15 // the percentage of placements lasting 15 days or longer for facilities nationwide was 53%

**p. 21: number of placements per facility from September 2018 to September 2023
use srms_data, clear
tab Facility if NE==1 // Plymouth 82 placements, 44%

**p. 21: detainee-requested or facility-initiated placements from September 2018 to September 2023
use srms_data, clear
tab Detainee if NE==1 // 95% were facility-initiated =>There were 12% more facility-initiated placements in NE facilities compared to others. 
tab Detainee // For reference, 83% of placements at facilities nationwide were facility-initiated.

**p. 21: *number of placements per facility from April 2024 to May 2025
use monthly_solitary, clear 
keep if NE==1
collapse (sum) Placement, by(Facilities)
bysort Facilities: sum Placement 
di 115/(16+115+48+33) // 54% in Plymouth

**p. 21: change in number of individuals placed in solitary in NE in November 2024 and January 2025
use monthly_solitary, clear
keep if NE==1
collapse (sum) Placement (lastnm) Month, by(MonthN Year)
sum Placements if Year==2024 & MonthN==11 // 2
sum Placements if Year==2025 & MonthN==1 // 46
di ((46-2)/2)*100 // 2200% increase

**p. 21: change in number of individuals placed in solitary nationwide in November 2024 and January 2025
use monthly_solitary, clear
collapse (sum) Placement (lastnm) Month, by(MonthN Year)
sum Placements if Year==2024 & MonthN==11 // 551
sum Placements if Year==2025 & MonthN==1 // 986
di ((986-551)/551)*100 // 79 % increase

**p. 21: change in number of individuals per month on average April 2024 - November 2024 to January 2025-May 2025
use monthly_solitary, clear
keep if NE==1
collapse (sum) Placement (lastnm) Month, by(MonthN Year)
sum Placements if Year==2024 & MonthN!=12 // 2
sum Placements if Year==2025 // 33
di ((33-2)/33)*100 //94% underreporting

**p. 23: length of solitary confinement placements for people with mental and serious mental illnesses from September 2018 to September 2023; frequency, percent, average and median length of placements by facility
use srms_data, clear
table (Facility) if NE==1 & Mental_b==1, statistic(mean Length) stat(median Length) stat(frequency) stat(percent) // average 19 days
table if Mental_b==1, statistic(mean Length) stat(median Length) // average 25 days
di (19-15)/15 // 27% longer than the UN threshold for torture

**p. 24: percent with mental illnesses from September 2018 to September 2023
use srms_data, clear
tab Mental_bin, mi // 38.4% missing mental illness indicator nationally
bysort NE:tab Mental_bin, mi // 38.17% missing mental illness indicator for New England
tab Mental_bin if NE==1 // 44% from placements where Mental Illness was identified, had a mental illness. 
tab Mental_bin // 40% of placements were identified with mental illness nationally.

**p. 24: increase in missing data for mental health indicator from September 2018 to September 2023
use srms_data, clear
keep if NE==1
replace ReleaseY=2023 if ReleaseY==.
tab Mental_b if ReleaseY==2022 | ReleaseY==2023, mi // 58 percent or 19 out of 33 reported "Yes" for Mental illness

**p. 25: percentage of placements including individuals with mental illnesses
tab Facility Mental_b, row 
 